﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<SinBiota.Model.Entities.Publication>>" %>
<%@ Import Namespace="Localization" %>
<%@ Import Namespace="Sinbiota.Web.Extensions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%: Strings.Publication %> 
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server"> 
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/Custom/BiotaAjaxFunctions.js")%>"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%--AJAX Details --%>
    <% using (Ajax.BeginForm("Details", null, new AjaxOptions {UpdateTargetId = "PublicationDetails", OnSuccess = "function() {showDetails('Publication');}", OnFailure = "OnAjaxFailure", LoadingElementId = "PublicationDetailsWaiting"}, new { id = "PublicationDetailsAjaxForm" }))
       { %>
    <%: Html.Hidden("id")%>
    <% } %>

<%--    <% using (Ajax.BeginForm("AjaxDelete", null, new AjaxOptions {Confirm = "ARe you sure?"}, new { id = "PublicationDeleteAjaxForm" }))
       { %>
    <%: Html.Hidden("deleteId")%>
    <% } %>
--%>
    <div id="PublicationDetails" title="<%: Strings.Publication %> - <%: Strings.Details %>"></div>
    <h2><%: Strings.Publication %> <img id='PublicationDetailsWaiting' style="display:none;" alt='waiting...' src='<%: Url.WaitingImage() %>'/></h2>
    <table>
    <thead>
        <tr class="header">
             <th width="40"></th>
            <th>
                <%: Strings.Title %>
            </th>
        </tr>
    </thead>
    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
            
            <% Html.RenderPartial("EditDetailsRemoveUserControl",item); %>
            </td>
            <td>
                <%: item.Title %>
            </td>
        </tr>
    
    <% } %>

    </table>

    <p class="small button radius">
        <%: Html.ActionLink(Strings.CreateNew, "Create") %>
    </p>

<script type="text/javascript">
//Little hack to enable ajaxform submit in the javascript; the trick is to call the onsubmit also; not needed on Firefox.
$("document").ready(function () {
    if(!$.browser.mozilla) $("form").submit(function (event) { eval($(this).attr("onsubmit")); return false; });
});
</script>
</asp:Content>


